Pay-Per-Use (by execution) License Model

Developing Applications Using The SoftwareShield System > Creating Licensing Solutions > Available License Models > Pay-Per-Use (by execution) License Model

## Pay-Per-Use (by execution) License Model

This model allows you to deliver software for which the user must pay every time they execute it.

Although not a time based limitation, pay-per-execution is actually classified as an expiration type license. For detailed information about expiration types and features see Expiring Licenses in the Feature Guide.

### Overview - How to Integrate the Pay-Per-Use (by execution) License Model Into Your Application

1. The first step is simply defining a license that uses an Execution Limit. Note that any of the three types of expiration can be individually used or used in combination with each other. If used in combination your application is expired as soon as any one of the types of expiration takes effect. This section deals with "execution limits". The execution limit is a fixed number of times that the user may run your software (more specifically that the StartUp function may be called). Once this limit is reached, your application is expired.

2. The next step is to ensure that your license has the necessary Authorization Definitions built into it. You decide which definitions to include based on how you want your licenses expiration to behave. There are several Authorization Definitions which can manipulate execution limit licenses. You may need a "Release All Expiration" definition, or a "Add Allowable Executions" definition. Please see Authorization Definitions for detailed information on the Authorization Definition features.

3. Once you are satisfied with your license, compile a distributed copy of it. The distributed copy is encrypted and compressed and only contains absolutely necessary information for the enforcement of your license. Place a copy of this distributed license in your applications directory. If you have decided to use steganographic alias files, make sure that they are also in the application directory. Have a look at the programming notes file that the SoftwareShield License Manager creates for your specific license. This will make your programming a little easier by supplying you with the code you will need to invoke the start up event. Please see Deploying the License for Your Application for more detailed information about deploying your license.

4. Next, in your programs startup event (main form load etc.) create an instance of the ClientProtector object (SSCProtector) and immediately call its StartUp function. You will have to pass specific parameters such as the license name, main license file password, and the finger print options code - but this code will have been already written for your convenience when you compiled your license - just look in the programming notes file created by the SoftwareShield License Manager. Have a look at the exact details of the StartUp function for more information on making this call.

5. Now, depending on the return value from the ClientProtector StartUp call (in the return_code reference parameter), you can determine if the license is expired or not. If you wish to give the user updated feedback about how many executions remain, you can make calls to the ClientProtector to get detailed information. See GetExecutionLimit, GetExecutionCount and GetExecutionsRemaining.
   What you choose to do after the execution limit is reached is up to you. You may prevent the program from running altogether or simply cripple it. If you choose to shut-down, be sure to give the user a chance to buy and possibly enter an Activation Code if they already have. For information on how to interpret the return_code parameter when deploying an execution limit version of your application, have a look at RETURNCODES.